﻿using GalaSoft.MvvmLight.Messaging;
using System.Windows;
using System.Windows.Controls;

namespace TransControlSystem.View
{
    /// <summary>
    /// PriorityConfigWindow.xaml 的交互逻辑
    /// </summary>
    public partial class PriorityConfigWindow : Window
    {
        public PriorityConfigWindow()
        {
            InitializeComponent();
            Messenger.Default.Register<NotificationMessage>(this, (nm) =>
            {
                if (nm.Notification == "HidPriorityConfigWindow")
                {
                    if (nm.Sender == DataContext)
                        Hide();
                }
            });
        }
        /// <summary>
        /// 本窗体关闭事件
        /// </summary>
        /// <param name="sender">本窗体</param>
        /// <param name="e">事件</param>
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = true;
            Visibility = Visibility.Hidden;
        }
        /// <summary>
        /// 主表格生产令事件
        /// </summary>
        /// <param name="sender">表格本身</param>
        /// <param name="e">事件</param>
        private void DataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
        {
            if (e.Column.Header.ToString() == "Id" ||
               e.Column.Header.ToString() == "TagDesc" ||
                  e.Column.Header.ToString() == "Priority" ||
                  e.Column.Header.ToString() == "IsDisplay" ||
                  e.Column.Header.ToString() == "PromotionPriorityIsDisplay" ||
                  e.Column.Header.ToString() == "ReductionPriorityIsDisplay" ||
                       e.Column.Header.ToString() == "TagType" ||
                     e.Column.Header.ToString() == "PriorityNo"
               )
            {
                e.Cancel = true;
            }
        }
    }
}
